package com.me.mynanogame;


import java.util.ArrayList;
import java.util.HashMap;

import Screens.Negotiation;
import Screens.Screen;
import Simulation.Simulation;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;


//main class
public class Main implements ApplicationListener{
	public static final Integer SCREEN_GAME = 0;
	public boolean initiated;
	public HashMap<Integer, Screen> screenList;
	public Screen activeScreen;
	
	public void initiate(){
		StaticTextures.initiate();
		StaticSprites.initiate();
		screenList = new HashMap<Integer, Screen>();
		screenList.put(SCREEN_GAME, new Negotiation(this, Renderer.getInstance(), new Simulation()));
		activeScreen = screenList.get(SCREEN_GAME);
		activeScreen.enter();
		initiated = true;
	}
	
	@Override
	public void create() {
		initiated = false;
	}

	public Screen getState(int id) {
		return screenList.get(id);
	}
	
	public void setScreen(int id) {
		activeScreen = screenList.get(id);
		activeScreen.enter();
	}
	
	@Override
	public void dispose() {
		//DisposableObjects.dispose();
	}

	@Override
	public void pause() {	
	}

	@Override
	public void render() {
		GL20 gl = Gdx.graphics.getGL20();
		gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		if (initiated) {
			activeScreen.update();
			activeScreen.render();
		}
		else{
			initiate();
		}
	}

	@Override
	public void resize(int arg0, int arg1) {
	
	}

	@Override
	public void resume() {
		
	}

}
